<?php $paymentForm->setDefault('transaction_type',$transaction_type);?>
<div id="<?php echo sfConfig::get('app_windows_payment_panel_id')?>">
<div class="form_title">New <?php echo $transaction_type?> Payment for <?php echo $contact->getListName() ?></div>
<?php if($total_receivable == 0): ?>
  <?php echo $contact->getListName() ?> has no receivable balance.
<?php else:?>
  <?php echo form_tag_for($paymentForm,'payment/insert',array('id'=>'formPayment',))?>
  
  <?php if($transaction_type=='CHECK'):?>
  <?php if($documentForm->hasErrors() || $paymentForm->hasErrors() || $paymentChecksForm->hasErrors()):?>
    <ul class="error_list"><li>Errors on form</ul>
  <?php endif;?>
  <?php echo $documentForm->renderGlobalErrors();?>
  <?php echo $paymentForm->renderGlobalErrors();?>
  <?php echo $paymentChecksForm->renderGlobalErrors();?>
  <?php else:?>
  <?php if($documentForm->hasErrors() || $paymentForm->hasErrors()):?>
    <ul class="error_list"><li>Errors on form</ul>
  <?php endif;?>
  <?php echo $documentForm->renderGlobalErrors();?>
  <?php echo $paymentForm->renderGlobalErrors();?>
  <?php endif;?>
  <font color="#FF0000"><?php echo $error_message;?></font>
    <table>
      <tr>
        <td class="container box">
          <?php include_partial('payment_form',array('documentForm'=>$documentForm,'paymentForm'=>$paymentForm,'transaction_type'=>$transaction_type,))?>
        </td>
        <?php if($transaction_type=='CHECK'):?>
          <td class="container box">
            <div class="separator">Check Payments</div>
            <?php include_partial('payment_checks_form',array('paymentChecksForm'=>$paymentChecksForm,))?>
          </td>
        <?php endif;?>
      </tr>
    </table>
    <center>
      <input type="submit" value="Save"/> | 
      <input type="reset" value="Reset"/>
    </center>
  </form>
<?php endif;?>
</div>


<script language="javascript">
  $(document).ready(
    function(){
      paymentNewSetup();
    }
  );
</script>